<?php

class Cms{
	
	function getPagesList(){
		global $ado;
		return $ado->exec("SELECT * FROM cms");
	}
	
	function getContent($page_name){
		global $ado;
		$row = $ado->fetch($ado->exec("SELECT page_content FROM cms where page_name = '$page_name'"));
		return $row['page_content'];
	}
	
	function saveCms($pages){
		global $ado;
	
		$pages = clean($pages);
		
		foreach($pages['page_content'] as $k=>$v){
			$page_name = $pages['page_name'][$k];
			$page_content = $pages['page_content'][$k];
			$ado->exec("UPDATE `cms` SET `page_content` = '$page_content' WHERE `page_name` = '$page_name'");	
		}
		return true;
		
	}
	
	
}
$cms = new Cms();

?>